package cn.duli.xianer.service.impl;

import cn.duli.xianer.dao.OrdersMapper;
import cn.duli.xianer.pojo.Orders;
import cn.duli.xianer.service.OrdersService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@Service
public class OrdersServiceImpl implements OrdersService {

    @Resource
    private OrdersMapper ordersMapper;

    @Override
    public int save(Orders orders) {
        ordersMapper.save(orders);
        return orders.getoId();
    }

    @Override
    public Orders findById(Integer oId) {
        return ordersMapper.findById(oId);
    }

    @Override
    public boolean updateOrderStatusByoNo(String parentNo, String payTime, String alipayNo) {
        int temp = ordersMapper.updateOrderStatusByoNo(parentNo, payTime, alipayNo);
        if (temp!=0) {
            return true;
        }
        return false;
    }

    @Override
    public Orders findByOrderNum(String orderNum) {
        return ordersMapper.findByOrderNum(orderNum);
    }

    @Override
    public Page<Orders> findOrdersByuId(Integer uId) {
        return ordersMapper.findOrdersByuId(uId);
    }

    @Override
    public int deleteById(Integer oId) {
        return ordersMapper.deleteById(oId);
    }

    @Override
    public int updateDeliverStatus(Integer oId) {
        return ordersMapper.updateDeliverStatus(oId);
    }

    @Override
    public int updateConfirmOrder(Integer oId) {
        return ordersMapper.updateConfirmOrder(oId);
    }

    @Override
    public int updateOrderClose(Integer oId) {
        return ordersMapper.updateOrderClose(oId);
    }

    @Override
    public List<Orders> findByParentNo(String parentNo) {
        return ordersMapper.findByParentNo(parentNo);
    }

    @Override
    public Orders findByGoodId(Integer gId) {
        return ordersMapper.findByGoodId(gId);
    }

    @Override
    public List<Orders> findNotPad(Integer uId) {
        return ordersMapper.findNotPad(uId);
    }

    @Override
    public Page<Orders> findByStatusPage(String status, Integer uId) {
        return ordersMapper.findByStatusPage(status, uId);
    }

    @Override
    public List<Orders> findByOrderStatus() {
        return ordersMapper.findByOrderStatus();
    }

    @Override
    public Page<Orders> findSellList(Integer uId) {
        return ordersMapper.findSellList(uId);
    }

    @Override
    public Page<Orders> findByStatusBySell(String status, Integer uId) {
        return ordersMapper.findByStatusBySell(status, uId);
    }

    @Override
    public int updateOrderStatus(Integer oId, Integer status) {
        return ordersMapper.updateOrderStatus(oId, status);
    }

    @Override
    public Page<Orders> findAll() {
        return ordersMapper.findAll();
    }

    @Override
    public List<Orders> findSuccess() {
        return ordersMapper.findSuccess();
    }

    @Override
    public List<Orders> findOrdersByGid(Integer gId,Integer uid) {
        return ordersMapper.findOrdersByGid(gId,uid);
    }

    @Override
    public List<Orders> findByCurrentUid(Integer uId) {
        return ordersMapper.findByCurrentUid(uId);
    }

    @Override
    public List<Orders> findByOthersUid(Integer uId) {
        return ordersMapper.findByOthersUid(uId);
    }


}
